diff options
author | No'am Rosenthal <noam.rosenthal@nokia.com> | 2009-08-10 00:05:47 -0700 |
---|---|---|
committer | No'am Rosenthal <noam.rosenthal@nokia.com> | 2009-08-10 00:05:47 -0700 |
commit | cbc30076b037cafb872310577f83609cc3f88bb0 (patch) | |
tree | 4becaede8d515ec62fa55139c2a64c54fdd84470 | |
parent | f1f797379920403bd68847988f78cab72c0fd111 (diff) |
Fixed loginmvc example to have better notificationsscc
-rw-r--r-- | scc/examples/loginmvc/frame.ui | 2 | ||||
-rw-r--r-- | scc/examples/loginmvc/main.cpp | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/scc/examples/loginmvc/frame.ui b/scc/examples/loginmvc/frame.ui index 7f984de..4b57955 100644 --- a/scc/examples/loginmvc/frame.ui +++ b/scc/examples/loginmvc/frame.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>Frame</string> + <string>Login Workflow</string> </property> <property name="frameShape"> <enum>QFrame::StyledPanel</enum> diff --git a/scc/examples/loginmvc/main.cpp b/scc/examples/loginmvc/main.cpp index c01a3be..25b68d1 100644 --- a/scc/examples/loginmvc/main.cpp +++ b/scc/examples/loginmvc/main.cpp @@ -117,6 +117,7 @@ class MyView : public QFrame, public virtual Ui::Frame { Q_OBJECT public: + QString welcomeText; MyView(QWidget* o = NULL) : QFrame(o) { setupUi(this); @@ -139,7 +140,7 @@ class MyView : public QFrame, public virtual Ui::Frame } void notifyWelcome() { - QMessageBox::information(this,"","Welcome!"); + QMessageBox::information(this,"Welcome!",welcomeText); } void notifyError() { @@ -162,14 +163,15 @@ class MyView : public QFrame, public virtual Ui::Frame int main(int argc, char *argv[]) { QApplication a(argc, argv); - - AbstractModel* model = QSslSocket::supportsSsl () ? (AbstractModel*)new GMailModel() : (AbstractModel*)new DummyModel(); + bool use_gmail = QSslSocket::supportsSsl () && !a.arguments().contains("--dummy"); + AbstractModel* model = use_gmail ? (AbstractModel*)new GMailModel() : (AbstractModel*)new DummyModel(); MyView* view = new MyView(); SMClass_controller *controller = new SMClass_controller(); controller->setupStateMachine(); controller->set_loginButton(view->loginButton); controller->set_logoutButton(view->logoutButton); controller->set_cancelButton(view->cancelButton); + view->welcomeText = (use_gmail ?"Please enter your GMail user/password":"Username=user, Password=password"); QObject::connect(controller,SIGNAL(event_login_action(QString,QString)),model,SLOT(login(QString,QString))); QObject::connect(controller,SIGNAL(event_notify_loggedIn()),view,SLOT(notifyLogin())); QObject::connect(controller,SIGNAL(event_notify_error()),view,SLOT(notifyError())); @@ -186,7 +188,6 @@ int main(int argc, char *argv[]) QObject::connect(view->timeoutSlider,SIGNAL(valueChanged(int)),controller,SLOT(set_loginTimeout(int))); controller->start(); view->show(); - QObject::connect(view,SIGNAL(closed()),qApp,SLOT(quit())); return a.exec(); } #include <main.moc> |